/*
 * dtapp 2.0
 *
 * 一切归零 QQ：170357286
 * Copyright 2016
 *
 */
window.apiUrl = 'http://www.dtjia.top/dtapp/';
//window.apiUrl = 'http://192.168.1.88:66/dtapp/';
window.apiread = 'readapp';
window.apipost = 'postapp';
var Nopic = '../image/nopic.gif';
var Noavatar = '../image/noavatar.gif';
var Loadpic = '../image/loading.png';
var blankgif = '../image/blank.gif';
var nodatas = '<li class="aui-list-view-cell aui-text-center aui-no-datas" data-win="list_arrow">暂时没有数据</li>';
var header_h = 60;
var loadpage = '<div class="load1"><div class="rect1"></div><div class="rect2"></div><div class="rect3"></div><div class="rect4"></div>';
var loadpage6 = '<div class="load6"><div class="bounce1"></div><div class="bounce2"></div><div class="bounce3"></div> <span class="h7">数据加载中...</span>';
var pagemax = 50;

function Dd(i) {return document.getElementById(i);}

   
function dcloseFrame(name){
        api.closeFrame({
    name: name
});
}

function dcloseWin(){
        api.closeWin();
}
function openSwitchBtn(obj, name, index) {
        $api.addCls(obj, 'active-warning');
        api.setFrameGroupIndex({
            name: 'footer_tab_list',
            index: index
        });
    }
      
/* 打开 */
function openindexWin(index) {//api.alert({msg:(index)});
    api.setFrameGroupIndex({
    name: 'footer_tab_list',
    index: index,
    scroll:true
})
    api.execScript({
    name:'root',
    //script:'openMenu()'
    })
}

function dopenFrame(name,url){
if(!url) url = name;
api.openFrame({
			name : name,
			url : url,
			pageParam : {},
			bounces : false,
			bgColor : 'rgba(0,0,0,0)',
			scrollToTop : true,
			vScrollBarEnabled : true,
			hScrollBarEnabled : false,
			scaleEnabled : false,
			showProgress : false,
			reload : false,
			allowEdit : true,
			softInputMode : 'auto',
			rect : {
				x : 0,
				y : 0,
				marginLeft : 0,
				marginTop : 0,
				marginBottom : 0,
				marginRight : 0
			}
			});

		}



function dopenWin(name) {
    api.openWin({
        name: name,
        url: name+'.html',
        opaque: true,
        vScrollBarEnabled: false

    });
}  

/* 打开 */
function dopenWins(itemid,path,show){
if(path) url = path+'/'+show+'.html';
        var delay = 0;
        var itemid = itemid;
        var module = module;

        if("ios" != api.systemType){
            delay = 300;
        }
        api.openWin({
                    name: show,
                    url: url,
                    pageParam: {
                        itemid: itemid
                    },
                    bounces: false,
                    vScrollBarEnabled:false,
                    hScrollBarEnabled:false,
                    reload: true,
                    delay: delay
                });
                
}

function openpcall(number) {
			api.call({
			type: 'tel_prompt',
            number: number
        });
		}
		

function setRefreshHeader() {
        api.setRefreshHeaderInfo({
            visible: true,
            bgColor: '#ccc',
            textColor: '#fff',
            textDown: '下拉刷新...',
            textUp: '松开刷新...',
            showTime: true
        }, function (ret, err) {
            //render();
            api.refreshHeaderLoadDone();
        });
    }

function render() {
        api.showProgress();
        renderBanner(bannerCallBack);
        renderList(listCallBack);
        renderTopic(topicCallBack);
        renderImgGroup(imgGroupCallBack);
        api.parseTapmode();
        api.hideProgress();
    }



function loadballhide(){
        $api.remove($api.dom('.aui-dots-loading'));
    }
    
function loadballshow(){
        var loading = $api.dom(".aui-dots-loading");
        if(!loading){
            $api.append($api.dom('body'),'<div class="aui-dots-loading"><span class="dots-loader">Loading&#8230;</span></div>');
        }
        
    }

function dtoast(msg,location) {
			api.toast({msg: msg, location: "middle"});
		}
		
function dperfec() {
			api.toast({msg: '拼命完善中', location: "middle"});
		}
		
function Valname(valname) {
    var valname = $api.val($api.byId(valname));
	valname = $api.trim(valname);
	return valname;
			}